//
//  ResultTableViewCell.m
//  KeepFit
//
//  Created by dllo on 15/10/30.
//  Copyright © 2015年 Fuzzie Liu. All rights reserved.
//

#import "ResultTableViewCell.h"

@implementation ResultTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.coverImageView = [[UIImageView alloc]init];
        self.nameLabel = [[UILabel alloc]init];
        self.nameLabel.font = [UIFont boldSystemFontOfSize:18];
        self.energyLabel = [[UILabel alloc]init];
        self.typeImageView = [[UIImageView alloc]init];
        [self.contentView addSubview: self.coverImageView];
        [self.contentView addSubview: self.nameLabel];
        [self.contentView addSubview: self.energyLabel];
        [self.contentView addSubview: self.typeImageView];
    
        
    }
    return self;
    
    
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat height = self.contentView.bounds.size.height / 2;
    
    self.coverImageView.frame = CGRectMake(5, 10, 60, height * 2 - 20);
//        self.coverImageView.backgroundColor = [UIColor redColor];
    self.coverImageView.layer.cornerRadius = height - 10;
    self.coverImageView.layer.masksToBounds = YES;
    self.coverImageView.layer.borderWidth = 1.5;
    self.coverImageView.layer.borderColor = [[UIColor colorWithRed:210 / 255.0 green:210 / 255.0 blue:210 / 255.0 alpha:1.0]CGColor];
    self.nameLabel.frame = CGRectMake(5 + 60 + 15, 10, self.contentView.frame.size.width - ( 5 + 60 + 5 + 35), 20);
//        self.nameLabel.backgroundColor = [UIColor redColor];
    self.energyLabel.frame = CGRectMake(5 + 60 + 15 , 10 + height, self.contentView.frame.size.width - ( 5 + 60 + 5 + 35), 20);
//        self.energyLabel.backgroundColor = [UIColor redColor];
    self.typeImageView.frame = CGRectMake(self.contentView.frame.size.width - 35, height - 15, 30, 30);
//        self.typeImageView.backgroundColor = [UIColor redColor];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
